﻿using Newtonsoft.Json;
using System.ComponentModel;

namespace VideoTools.vo
{

    public enum GoogleTranslateBigLanguages
    {
        [Description("中文")]
        zh,
        [Description("英语")]
        en,
        [Description("德语")]
        de,
        [Description("日语")]
        ja,
        [Description("法语")]
        fr,
        [Description("韩语")]
        ko,
        [Description("俄语")]
        ru,
        [Description("意大利语")]
        it,
        [Description("阿拉伯语")]
        ar,
        [Description("西班牙语")]
        es,
        [Description("葡萄牙语")]
        pt

    };
    //https://cloud.google.com/translate/docs/languages?hl=zh-cn
    public enum GoogleTranslateLanguage
    {
        [Description("中文")]
        zh,
        [Description("英语")]
        en,
        [Description("南非荷兰语")]
        af,
        [Description("阿尔巴尼亚语")]
        sq,
        [Description("阿姆哈拉语")]
        am,
        [Description("阿拉伯语")]
        ar,
        [Description("亚美尼亚文")]
        hy,
        [Description("艾马拉语")]
        ay,
        [Description("阿塞拜疆语")]
        az,
        [Description("班巴拉语")]
        bm,
        [Description("巴斯克语")]
        eu,
        [Description("白俄罗斯语")]
        be,
        [Description("孟加拉文")]
        bn,
        [Description("博杰普尔语")]
        bho,
        [Description("波斯尼亚语")]
        bs,
        [Description("保加利亚语")]
        bg,
        [Description("加泰罗尼亚语")]
        ca,
        [Description("宿务语")]
        ceb,
        [Description("科西嘉语")]
        co,
        [Description("克罗地亚语")]
        hr,
        [Description("捷克语")]
        cs,
        [Description("丹麦语")]
        da,
        [Description("迪维希语")]
        dv,
        [Description("多格来语")]
        doi,
        [Description("荷兰语")]
        nl,
        [Description("世界语")]
        eo,
        [Description("爱沙尼亚语")]
        et,
        [Description("埃维语")]
        ee,
        [Description("菲律宾语")]
        fil,
        [Description("芬兰语")]
        fi,
        [Description("法语")]
        fr,
        [Description("弗里斯兰语")]
        fy,
        [Description("加利西亚语")]
        gl,
        [Description("格鲁吉亚语")]
        ka,
        [Description("德语")]
        de,
        [Description("希腊文")]
        el,
        [Description("瓜拉尼人")]
        gn,
        [Description("古吉拉特文")]
        gu,
        [Description("海地克里奥尔语")]
        ht,
        [Description("豪萨语")]
        ha,
        [Description("夏威夷语")]
        haw,
        [Description("希伯来语")]
        he,
        [Description("印地语")]
        hi,
        [Description("苗语")]
        hmn,
        [Description("匈牙利语")]
        hu,
        [Description("伊博语")]
        ig,
        [Description("伊洛卡诺语")]
        ilo,
        [Description("印度尼西亚语")]
        id,
        [Description("爱尔兰语")]
        ga,
        [Description("意大利语")]
        it,
        [Description("日语")]
        ja,
        [Description("爪哇语")]
        jv,
        [Description("卡纳达文")]
        kn,
        [Description("哈萨克语")]
        kk,
        [Description("高棉语")]
        km,
        [Description("卢旺达语")]
        rw,
        [Description("贡根语")]
        gom,
        [Description("韩语")]
        ko,
        [Description("克里奥尔语")]
        kri,
        [Description("库尔德语")]
        ku,
        [Description("库尔德语")]
        ckb,
        [Description("吉尔吉斯语")]
        ky,
        [Description("老挝语")]
        lo,
        [Description("拉丁文")]
        la,
        [Description("拉脱维亚语")]
        lv,
        [Description("林格拉语")]
        ln,
        [Description("立陶宛语")]
        lt,
        [Description("卢干达语")]
        lg,
        [Description("卢森堡语")]
        lb,
        [Description("马其顿语")]
        mk,
        [Description("迈蒂利语")]
        mai,
        [Description("马尔加什语")]
        mg,
        [Description("马来语")]
        ms,
        [Description("马拉雅拉姆文")]
        ml,
        [Description("马耳他语")]
        mt,
        [Description("毛利语")]
        mi,
        [Description("马拉地语")]
        mr,
        [Description("梅泰语")]
        lus,
        [Description("蒙古文")]
        mn,
        [Description("缅甸语")]
        my,
        [Description("尼泊尔语")]
        ne,
        [Description("挪威语")]
        no,
        [Description("尼杨扎语")]
        ny,
        [Description("奥里亚语")]
        or,
        [Description("奥罗莫语")]
        om,
        [Description("普什图语")]
        ps,
        [Description("波斯语")]
        fa,
        [Description("波兰语")]
        pl,
        [Description("葡萄牙语")]
        pt,
        [Description("旁遮普语")]
        pa,
        [Description("克丘亚语")]
        qu,
        [Description("罗马尼亚语")]
        ro,
        [Description("俄语")]
        ru,
        [Description("萨摩亚语")]
        sm,
        [Description("梵语")]
        sa,
        [Description("苏格兰盖尔语")]
        gd,
        [Description("塞佩蒂语")]
        nso,
        [Description("塞尔维亚语")]
        sr,
        [Description("塞索托语")]
        st,
        [Description("修纳语")]
        sn,
        [Description("信德语")]
        sd,
        [Description("僧伽罗语")]
        si,
        [Description("斯洛伐克语")]
        sk,
        [Description("斯洛文尼亚语")]
        sl,
        [Description("索马里语")]
        so,
        [Description("西班牙语")]
        es,
        [Description("巽他语")]
        su,
        [Description("斯瓦希里语")]
        sw,
        [Description("瑞典语")]
        sv,
        [Description("塔加路语")]
        tl,
        [Description("塔吉克语")]
        tg,
        [Description("泰米尔语")]
        ta,
        [Description("鞑靼语")]
        tt,
        [Description("泰卢固语")]
        te,
        [Description("泰语")]
        th,
        [Description("蒂格尼亚语")]
        ti,
        [Description("宗加语")]
        ts,
        [Description("土耳其语")]
        tr,
        [Description("土库曼语")]
        tk,
        [Description("契维语")]
        ak,
        [Description("乌克兰语")]
        uk,
        [Description("乌尔都语")]
        ur,
        [Description("维吾尔语")]
        ug,
        [Description("乌兹别克语")]
        uz,
        [Description("越南语")]
        vi,
        [Description("威尔士语")]
        cy,
        [Description("班图语")]
        xh,
        [Description("意第绪语")]
        yi,
        [Description("约鲁巴语")]
        yo,
        [Description("祖鲁语")]
        zu,

    };
    public class GooglePayload
    {
        public string language { get; set; }
        public List<string> targets { get; set; }

        private string toJson()
        {
            List<dynamic> o =new List<dynamic>();
            o.Add(targets);
            o.Add("auto");
            o.Add(language);
            List<dynamic> o1 = new List<dynamic>();
            o1.Add(o);
            o1.Add("t1");
            return JsonConvert.SerializeObject(o1);

        }

        public string ToString()
        {
            if(targets == null || targets.Count == 0)
            {
                return null;
            }
            if (language == null || language.Length == 0)
            {
                return null;
            }
            return toJson();
            /*StringBuilder sb = new StringBuilder();
            sb.Append("[");
            sb.Append("[");
            string v = JsonConvert.SerializeObject(targets);
            sb.Append(v);
            sb.Append(",");
            sb.Append("\"auto\",");
            sb.Append("\""+language+"\"");
            sb.Append("],");
            sb.Append("\"te\"");
            sb.Append("]");
            return sb.ToString();*/
        }
    }
}
